package model;

public class Student {
    private final String name;
    private final int preferredQuantity;
    private final PaperType preferredType;
    
    public Student(String name, int quantity, PaperType type) {
        if (name == null || name.isEmpty()) {
            throw new IllegalArgumentException("学生姓名不能为空");
        }
        if (quantity <= 0) {
            throw new IllegalArgumentException("期望数量必须大于0");
        }
        if (type == null) {
            throw new IllegalArgumentException("偏好类型不能为空");
        }
        
        this.name = name;
        this.preferredQuantity = quantity;
        this.preferredType = type;
    }
    
    public String getName() {
        return name;
    }
    
    public int getPreferredQuantity() {
        return preferredQuantity;
    }
    
    public PaperType getPreferredPaperType() {
        return preferredType;
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return name.equals(student.name);
    }
    
    @Override
    public int hashCode() {
        return name.hashCode();
    }
}